feat: add unified search to trends, posts, users#514
Merged
CedrikNikita merged 1 commit intodevelopfrom Mar 31, 2026
Merged
Conversation
✅ Deploy Preview for fancy-gelato-7cdad5 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
eacfd69 to
cdbb4c6
Compare
cdbb4c6 to
ed227b8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Incorrect type assertion on awaited value casts as Promise
- I fixed the precedence issue by parenthesizing the
as Promise<...>assertions so the cast applies beforeawaitin all flagged calls.
- I fixed the precedence issue by parenthesizing the
- ✅ Fixed: Fallback query keys unnecessarily include search term
- I removed
searchTermfrom fallback query keys so identical fallback requests share one React Query cache entry.
- I removed
Or push these changes by commenting:
@cursor push 54a00b9e8f
Preview (54a00b9e8f)
diff --git a/src/features/trending/api/trendsSearch.ts b/src/features/trending/api/trendsSearch.ts
--- a/src/features/trending/api/trendsSearch.ts
+++ b/src/features/trending/api/trendsSearch.ts
@@ -141,23 +141,23 @@
switch (tab) {
case 'tokens':
- return normalizeSection<TrendTokenItem>(await SuperheroApi.listTokens({
+ return normalizeSection<TrendTokenItem>(await (SuperheroApi.listTokens({
search: term,
limit: SEARCH_FULL_LIMIT,
page: 1,
orderBy: 'market_cap',
orderDirection: 'DESC',
- }) as Promise<PaginatedApiResponse<TrendTokenItem>>);
+ }) as Promise<PaginatedApiResponse<TrendTokenItem>>));
case 'users':
return normalizeSection<TrendUserItem>(await fetchAccountSearch(SEARCH_FULL_LIMIT, term));
case 'posts':
- return normalizeSection<TrendPostItem>(await SuperheroApi.listPosts({
+ return normalizeSection<TrendPostItem>(await (SuperheroApi.listPosts({
search: term,
limit: SEARCH_FULL_LIMIT,
page: 1,
orderBy: 'created_at',
orderDirection: 'DESC',
- }) as Promise<PaginatedApiResponse<TrendPostItem>>);
+ }) as Promise<PaginatedApiResponse<TrendPostItem>>));
default: {
const exhaustive: never = tab;
throw new Error(`Unknown search tab: ${exhaustive}`);
@@ -166,20 +166,20 @@
}
export async function fetchTrendingTokens(limit: number = DEFAULT_TAB_LIMIT) {
- return normalizeSection<TrendTokenItem>(await SuperheroApi.listTokens({
+ return normalizeSection<TrendTokenItem>(await (SuperheroApi.listTokens({
limit,
page: 1,
orderBy: 'trending_score',
orderDirection: 'DESC',
- }) as Promise<PaginatedApiResponse<TrendTokenItem>>);
+ }) as Promise<PaginatedApiResponse<TrendTokenItem>>));
}
export async function fetchPopularPosts(limit: number = DEFAULT_TAB_LIMIT) {
- return normalizeSection<TrendPostItem>(await SuperheroApi.listPopularPosts({
+ return normalizeSection<TrendPostItem>(await (SuperheroApi.listPopularPosts({
window: 'all',
limit,
page: 1,
- }) as Promise<PaginatedApiResponse<TrendPostItem>>);
+ }) as Promise<PaginatedApiResponse<TrendPostItem>>));
}
export async function fetchTopTraders(limit: number = DEFAULT_TAB_LIMIT) {
diff --git a/src/features/trending/views/TokenList.tsx b/src/features/trending/views/TokenList.tsx
--- a/src/features/trending/views/TokenList.tsx
+++ b/src/features/trending/views/TokenList.tsx
@@ -381,7 +381,7 @@
enabled: hasSearch
&& searchPreviewQuery.isSuccess
&& searchPreviewQuery.data.tokens.items.length === 0,
- queryKey: ['trends', 'fallback', 'tokens', searchTerm],
+ queryKey: ['trends', 'fallback', 'tokens'],
queryFn: () => fetchTrendingTokens(FALLBACK_LIMIT),
staleTime: 60 * 1000,
});
@@ -390,7 +390,7 @@
enabled: hasSearch
&& searchPreviewQuery.isSuccess
&& searchPreviewQuery.data.users.items.length === 0,
- queryKey: ['trends', 'fallback', 'users', searchTerm],
+ queryKey: ['trends', 'fallback', 'users'],
queryFn: () => fetchTopTraders(FALLBACK_LIMIT),
staleTime: 60 * 1000,
});
@@ -399,7 +399,7 @@
enabled: hasSearch
&& searchPreviewQuery.isSuccess
&& searchPreviewQuery.data.posts.items.length === 0,
- queryKey: ['trends', 'fallback', 'posts', searchTerm],
+ queryKey: ['trends', 'fallback', 'posts'],
queryFn: () => fetchPopularPosts(FALLBACK_LIMIT),
staleTime: 60 * 1000,
});This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
ed227b8 to
b41bc2e
Compare
Jeanclaudeaoun
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Note
Medium Risk
Touches a large, user-facing view with multiple new queries, conditional rendering paths, and navigation behaviors; main risk is regressions in trends browsing/search UX and API query wiring rather than security/data integrity.
Overview
Adds a unified search experience to the Trends
TokenListview: a single search input queries tokens, users, and posts, hides the normal tabs while searching, and shows sectioned results with smart ordering (including address exact-match boosting), per-section “View all/Show less” expansion, and error/loading states.Introduces new
trendsSearchAPI helpers to fetch preview results (3 per section), full section results (24), and fallback content (trending tokens, popular posts, top traders) with consistent pagination normalization.Updates the non-search view to support three tabs (
Tokens,Users,Posts) whereUsersshows top traders andPostsshows popular posts, and adds Vitest coverage for both the new API helpers and the updatedTokenListbehavior.Written by Cursor Bugbot for commit b41bc2e. This will update automatically on new commits. Configure here.